﻿<?php
	echo form_fieldset("");
	echo form_open('cliente/todos');
	
	$atributos['id'] = $atributos['name'] = 'busca';
	$atributos['size'] = $atributos['maxlength'] = 40;
	$atributos['value'] = set_value('busca');	
	$atributos['style'] = 'float:left; margin:0; margin-right: 10px;';
	$atributos['placeholder'] = 'Nome do Cliente';
	echo form_input($atributos).nbs(5);
	
	$attr['class'] = 'btn btn-small';
	$attr['style'] = 'float:left;margin:0;';
	$attr['value'] = 'Buscar Cliente';
	echo form_submit($attr);
	
	echo form_close();
	echo form_fieldset_close();

	if(isset($busca))
	{
		echo "<table class='table table-striped table-bordered'><tr><th>ID</th><th>Nome</th></tr>";
		foreach($busca as $c)
		{
			echo"<tr><td><span class='label'>"; 
			echo $c->getIdCliente();

			echo"</span></td><td><span class='label label-info'>";
			echo $c->getNomeCliente();

			echo"</span></td><td><center>";
			echo anchor('cliente/'.$c->getIdCliente(), '<button class="btn btn-info"><i class="icon-search icon-white"></i> Visualizar</button>');

			echo"</center></td><td><center>";
			echo anchor('cliente/editar/'.$c->getIdCliente(), '<button class="btn btn-primary"><i class="icon-pencil icon-white"></i> Editar</button>');
			
			echo"</center></td><td><center>";
			echo anchor('cliente/excluir/'.$c->getIdCliente(), '<button class="btn btn-danger"><i class="icon-remove icon-white"></i> Excluir</button>');
			echo"</td></tr></center>";
		}
		echo '</table><center>'.$this->pagination->create_links().'</center></br>';
	}
	else echo "</br><span>Não há clientes cadastrados ou sua busca não obteve resultados.</span>";
?>